package com.yhb.utils;

import me.edzh.spring.bootstrap.common.GlobalPropertiesConfigurer;
import me.edzh.spring.bootstrap.service.impl.OSSServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class OSSConfig implements OSSServiceImpl.OSSConfig {
    @Override
    public String getAK() {
        return GlobalPropertiesConfigurer.getProperty("aliyun.oss.ak");
    }

    @Override
    public String getAS() {
        return GlobalPropertiesConfigurer.getProperty("aliyun.oss.sk");
    }

    @Override
    public String getEndPoint() {
        return GlobalPropertiesConfigurer.getProperty("aliyun.oss.endpoint");
    }

    @Override
    public String getRegion() {
        return GlobalPropertiesConfigurer.getProperty("aliyun.oss.region");
    }

    @Override
    public String getRoleArn() {
        return GlobalPropertiesConfigurer.getProperty("aliyun.oss.roleArn");
    }

    @Override
    public Long getDuration() {
        return 60L * 15; // 15min
    }

    @Override
    public String getBucketName() {
        return GlobalPropertiesConfigurer.getProperty("aliyun.oss.bucketName");
    }

    @Override
    public Long getURLSignExpiration() {
        return 3600 * 1000L; // 1H
    }
}
